home *** CD-ROM | disk | FTP | other *** search
/ Team Palmtops 7 / Palmtops_numero07.iso / WinCE / SDKWindowsCE / HandHeldPCPro30 / sdk.exe / Jupiter SDK / data1.cab / Emulation_Include_Files / cesync.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-02-19  |  24.9 KB  |  490 lines

  1. /*++
  2.  
  3. Copyright (c) 1996-1997, Microsoft Corporation
  4.  
  5. Module Name:
  6.  
  7.  
  8.     cesync.h
  9.  
  10. Abstract:
  11.  
  12.     Include file for synchronization modules for Windows CE
  13.  
  14. --*/
  15. #ifndef _INC_CESYNC_H
  16. #define _INC_CESYNC_H
  17.  
  18. // max size of the object type name
  19. #define MAX_OBJTYPE_NAME    100
  20.  
  21. // max. size of a packet in IReplObjHandler::GetPacket & IReplObjHandler::SetPacket (about 254K)
  22. #define MAX_PACKET_SIZE     260000
  23.  
  24. #define MAX_ACTIVE_VOL      16                  // up to 16 active volumes (including the default system volume) can be synchronized during each connection
  25.  
  26. typedef struct _tagReplSetup *PREPLSETUP;
  27.  
  28. typedef TCHAR   OBJTYPENAME[ MAX_OBJTYPE_NAME ];
  29. typedef char    OBJTYPENAMEA[ MAX_OBJTYPE_NAME ];
  30. typedef WCHAR   OBJTYPENAMEW[ MAX_OBJTYPE_NAME ];
  31.  
  32. #define FACILITY_CESYNC     0x14
  33. #define MAKE_RERR(code)     ((HRESULT)(MAKE_SCODE( SEVERITY_ERROR, FACILITY_CESYNC, code )))
  34. #define MAKE_RWRN(code)     ((HRESULT)(MAKE_SCODE( SEVERITY_SUCCESS, FACILITY_CESYNC, code )))
  35.  
  36. #ifndef UNDER_CE
  37. typedef struct _REPLOBJ FAR *HREPLOBJ;
  38. typedef struct _REPLITEM FAR *HREPLITEM;
  39. typedef struct _REPLFLD FAR *HREPLFLD;
  40.  
  41. #endif
  42.  
  43. // Error/Return code used
  44. #define RERR_SHUT_DOWN      MAKE_RERR( 0x0001 ) // serious error, asking implementation to shut down immediately
  45. #define RERR_STORE_REPLACED MAKE_RERR( 0x0002 ) // the store was replaced.
  46. #define RERR_CANCEL         MAKE_RERR( 0x0003 ) // user cancel the operation
  47. #define RERR_RESTART        MAKE_RERR( 0x0004 ) // restart the operation, applicable in RSC_END_SYNC & RSC_END_CHECK
  48. #define RERR_IGNORE         MAKE_RERR( 0x0005 ) // used by IReplStore::GetConflictInfo.
  49. #define RERR_UNLOAD         MAKE_RERR( 0x0006 ) // used by IReplStore::ActivateDialog or IReplStore::IsFolderChanged to request unloading of replication modules 
  50. #define RERR_OBJECT_DELETED MAKE_RERR( 0x0007 ) // used by IReplStore::IsValidObject, indicates the object identified by the hObject is deleted
  51. #define RERR_CORRUPT        MAKE_RERR( 0x0008 ) // used by IReplStore::IsValidObject, indicates the object identified by the hObject is corrupted
  52. #define RERR_NO_DEVICE      MAKE_RERR( 0x0009 ) // returned by IReplNotify::QueryDevice. indicates no selected or connected device exists
  53. #define RERR_NO_ERR_PROMPT  MAKE_RERR( 0x0010 ) // returned by IReplStore::Initialize. indicates error initializing. No UI is needed to show this error.
  54. #define RERR_DISCARD        MAKE_RERR( 0x0011 ) // returned by IReplObjHandler::SetPacket. indicates this object should be discarded from the device immediately.
  55. #define RERR_DISCARD_LOCAL  MAKE_RERR( 0x0012 ) // returned by IReplObjHandler::SetPaket. indicates this object should be discarded from the desktop only.
  56. #define RERR_VOL_INACTIVE   MAKE_RERR( 0x0013 ) // returned by IReplObjHandler::GetPacket && IReplObjHandler::SetPacket, the volume has become inactive.
  57. #define RERR_BIG_OBJ_TYPE   MAKE_RERR( 0x0014 ) // returned by IReplNotify::QueryDevice on QDC_SYNC_DATA
  58. #define RERR_BIG_CODE       MAKE_RERR( 0x0015 ) // returned by IReplNotify::QueryDevice on QDC_SYNC_DATA
  59. #define RERR_UNMATCHED      MAKE_RERR( 0x0016 ) // returned by IReplNotify::QueryDevice on QDC_SYNC_DATA
  60. #define RERR_DEVICE_WIN     MAKE_RERR( 0x0017 ) // returned by IReplStore::GetConflictInfo, resolve the conflict so device object wins
  61. #define RERR_DESKTOP_WIN    MAKE_RERR( 0x0018 ) // returned by IReplStore::GetConflictInfo, resolve the conflict so desktop object wins
  62. #define RERR_SKIP_ALL_OBJ   MAKE_RERR( 0x0019 ) // returned by IReplStore::ReportStatus on RSC_WRITE_OBJ_FAILED, skip sync of all remaining objects
  63.  
  64. // use by IReplObjHandler
  65. #define RERR_SKIP_ALL       MAKE_RERR( 0x0100 )  // skip all incoming packets because of write errors
  66. #define RERR_BAD_OBJECT     MAKE_RERR( 0x0101 )  // this is a bad object because of read error, server should not try to replicate it again
  67. #define RERR_TRY_AGAIN      MAKE_RERR( 0x0102 )  // this is a bad object because of read error, server should can try to replicate it again later
  68. #define RERR_USER_SKIP      MAKE_RERR( 0x0103 )  // object skipped by the user
  69.  
  70. // these are warning codes
  71. #define RWRN_LAST_PACKET    MAKE_RWRN( 0x0001 )
  72.  
  73. // flags used in RSC_BEGIN_SYNC
  74. #define BSF_AUTO_SYNC           ((UINT)0x00000001)  // sync get started as a result of changes while auto. sync on change is turned on
  75. #define BSF_REMOTE_SYNC         ((UINT)0x00000002)  // consistent with RSC_REMOTE_SYNC, set if we are sync'ing remotely
  76. #define BSF_RESERVED            ((UINT)0x80000000)  // Reserved by ActiveSync server.
  77.  
  78. // Code for ReportStatus
  79. #define RSC_BEGIN_SYNC          ((UINT)1)   // Synchronization is about to start, uReserved is combination of bit flags, see BSF_* above
  80. #define RSC_END_SYNC            ((UINT)2)   // Synchronization is about to end
  81. #define RSC_BEGIN_CHECK         ((UINT)3)   // FindFirstItem is about to be called, followed by FindNextItem
  82. #define RSC_END_CHECK           ((UINT)4)   // FindItemClose has been called
  83. #define RSC_DATE_CHANGED        ((UINT)5)   // System Date has changed, this is called for each known desktop object
  84. #define RSC_RELEASE             ((UINT)6)   // Replication is about to release the store
  85. #define RSC_REMOTE_SYNC         ((UINT)7)   // Indicates if remote sync is enabled. uParam will TRUE if all sync 
  86.                                             // will be remote until this status is reported again with uParam set to FALSE
  87. #define RSC_INTERRUPT           ((UINT)8)   // interrupt current operation
  88. #define RSC_BEGIN_SYNC_OBJ      ((UINT)9)   // Synchronization is about to start on an object type. uReserved points to 
  89. #define RSC_END_SYNC_OBJ        ((UINT)10)  // Synchronization is about to end on an object type.
  90. #define RSC_OBJ_TYPE_ENABLED    ((UINT)11)  // Synchronization of the given object is enabled, hFolder is indeed a pointer to a string (object type name)
  91. #define RSC_OBJ_TYPE_DISABLED   ((UINT)12)  // Synchronization of the given object is disabled, hFolder is indeed a pointer to a string (object type name)
  92. #define RSC_BEGIN_BATCH_WRITE   ((UINT)13)  // A series of SetPacket will be called on a number of objects, this is the right time for some service providers to start a transaction
  93. #define RSC_END_BATCH_WRITE     ((UINT)14)  // above write ends, this is the right time for some service providers to commit the transaction
  94. #define RSC_CONNECTION_CHG      ((UINT)15)  // connection status has changed. uParam is TRUE if connection established. FALSE otherwise.
  95. #define RSC_WRITE_OBJ_FAILED    ((UINT)16)  // failed writing an object on the device. uParam is the HRESULT code.
  96. #define RSC_DELETE_OBJ_FAILED   ((UINT)17)  // failed deleting an object on the device. uParam is the HRESULT code.
  97. #define RSC_WRITE_OBJ_SUCCESS   ((UINT)18)  // writing of an object succeeded on the device. uParam is a pointer to SDREQUEST (with (lpbData, cbData) representing the volume ID)
  98. #define RSC_DELETE_OBJ_SUCCESS  ((UINT)19)  // deletion of an object succeeded on the device. uParam is a pointer to SDREQUEST (with (lpbData, cbData) representing the volume ID)
  99. #define RSC_READ_OBJ_FAILED     ((UINT)20)  // failed to read an object from the device. uParam is the HRESULT code
  100. #define RSC_TIME_CHANGED        ((UINT)21)  // System time has changed, this is called only once.
  101.  
  102. //
  103. //========================= IReplNotify ==============================
  104. //
  105.  
  106. typedef struct tagDevInfo
  107. {
  108.     DWORD   pid;                // device ID
  109.     char    szName[ MAX_PATH ]; // device name
  110.     char    szType[ 80 ];       // device type
  111.     char    szPath[ MAX_PATH ]; // device path
  112. } DEVINFO, *PDEVINFO;
  113.  
  114. // a structure used to get/set custom sync. data from/to the device
  115. typedef struct SDREQUEST
  116. {
  117.     OBJTYPENAME szObjType;  // the object type where this data is coming from
  118.     BOOL        fSet;       // TRUE if sending data down and FALSE if getting data up
  119.     UINT        uCode;      // for getting data from the device, this code must be less than 8
  120.     LPBYTE      lpbData;
  121.     UINT        cbData;
  122. } SDREQUEST, *PSDREQUEST;
  123.  
  124. // code for QueryDevice
  125. #define QDC_SEL_DEVICE      1   // Selected device info, *ppvData points to DEVINFO
  126. #define QDC_CON_DEVICE      2   // Connected device info, *ppvData points to DEVINFO
  127. #define QDC_SEL_DEVICE_KEY  3   // get a registry key that can be used to store selected device specific settings. 
  128.                                 // *ppvData points to HKEY, caller must close reg key when its usage is over
  129. #define QDC_CON_DEVICE_KEY  4   // get a registry key that can be used to store connnected device specific settings. 
  130.                                 // *ppvData points to HKEY, caller must close reg key when its usage is over
  131. #define QDC_SYNC_DATA   5       // get or set custom sync data from the device, *ppvData points to SDREQUEST
  132.  
  133. #define INF_OVERRIDE        ((UINT)0x0001000)   // used for OnItemNotify, overrid3 the default action of "delete wins over change"
  134.  
  135. #undef  INTERFACE
  136. #define INTERFACE   IReplNotify
  137. DECLARE_INTERFACE_( IReplNotify, IUnknown )
  138. {
  139. #ifndef UNDER_CE
  140.     STDMETHOD(       SetStatusText)     ( THIS_ LPSTR lpszText ) PURE;
  141.     STDMETHOD_(HWND, GetWindow)         ( THIS_ UINT uFlags ) PURE;
  142.     STDMETHOD(       OnItemNotify )     ( THIS_ UINT uCode, LPSTR lpszProgId, LPSTR lpszName, HREPLITEM hItem, ULONG ulFlags ) PURE;
  143.     STDMETHOD(       QueryDevice )      ( THIS_ UINT uCode, LPVOID *ppvData ) PURE;
  144. #endif
  145.  
  146.     // Internal use only
  147.     STDMETHOD(       OnItemCompleted )  ( THIS_ PREPLSETUP pSetup ) PURE;
  148. };
  149.  
  150. #define RNC_CREATED     1
  151. #define RNC_MODIFIED    2
  152. #define RNC_DELETED     3
  153. #define RNC_SHUTDOWN    4
  154.  
  155.  
  156. #ifndef UNDER_CE
  157.  
  158. #define SCF_SINGLE_THREAD   ((UINT)0x00000001)  // set if the implementation only supports single thread operation.
  159. #define SCF_SIMULATE_RTS    ((UINT)0x00000002)  // set if the implementation wants to simulate detection of real-time change/deletes
  160.  
  161. typedef struct tagStoreInfo
  162. {
  163.     UINT    cbStruct;               // Size of this structure
  164.     UINT    uFlags;                 // Miscelleanous flags on the store, see SCF_xxx above
  165.     TCHAR   szProgId[ 256 ];        // Output, ProgID name of the store object
  166.     TCHAR   szStoreDesc[ 200 ];     // Output, description of the store, will be displayed to the user
  167.     UINT    uTimerRes;              // Input/Output, resolution of timer in micro-seconds. 5000 by default.
  168.  
  169.     UINT    cbMaxStoreId;           // Input, max. size of the store ID that can be stored in buffer pointed by lpbStoreId.
  170.     UINT    cbStoreId;              // Output, actual size of the store ID stored in buffer pointed by lpbStoreId
  171.     LPBYTE  lpbStoreId;             // Output pointer to a buffer of anything that uniquely
  172.                                     // identifies the current store instance (Eg. a schedule file)
  173. } STOREINFO, *PSTOREINFO;
  174.  
  175. typedef struct tagObjUIData
  176. {
  177.     UINT        cbStruct;               // size of this structure
  178.     HICON       hIconLarge;             // Handle of a large icon used in the list view display in Synchronization Status
  179.     HICON       hIconSmall;             // Handle of a small icon used in the list view display in Synchronization Status
  180.     char        szName[ MAX_PATH ];     // Text displayed in the "Name" column in Synchronization Status
  181.     char        szSyncText[ MAX_PATH ]; // Text displayed in the  "Sync Copy In" column in Synchronization Status
  182.     char        szTypeText[ 80 ];       // Text displayed in the  "Type" column in Synchronization Status
  183.     char        szPlTypeText[ 80 ];     // Plural form of text displayed in the  "Type" column in Synchronization Status
  184. } OBJUIDATA, *POBJUIDATA;
  185.  
  186. enum ReplDialogs
  187. {
  188.     OPTIONS_DIALOG,
  189. };
  190.  
  191. //
  192. //========================= IEnumReplItem ==============================
  193. //
  194. DEFINE_GUID( IID_IEnumReplItem,              /* a417bc0e-7be1-11ce-ad82-00aa006ec559 */
  195.     0xa417bc0e,
  196.     0x7be1,
  197.     0x11ce,
  198.     0xad, 0x82, 0x00, 0xaa, 0x00, 0x6e, 0xc5, 0x59
  199. );
  200.  
  201. #undef  INTERFACE
  202. #define INTERFACE   IEnumReplItem
  203. DECLARE_INTERFACE_( IEnumReplItem, IUnknown )
  204. {
  205.     STDMETHOD(Next)                         ( THIS_ ULONG celt, HREPLITEM *phItem, ULONG *pceltFetched ) PURE;
  206.     STDMETHOD(Skip)                         ( THIS_ ULONG celt ) PURE;
  207.     STDMETHOD(Reset)                        ( THIS ) PURE;
  208.     STDMETHOD(Clone)                        ( THIS_ IEnumReplItem **ppenum ) PURE;
  209.     STDMETHOD_( HREPLFLD, GetFolderHandle)  ( THIS ) PURE;
  210. };
  211.  
  212. typedef struct tagConfInfo
  213. {
  214.     UINT        cbStruct;
  215.     HREPLFLD    hFolder;
  216.     HREPLITEM   hLocalItem;
  217.     HREPLITEM   hRemoteItem;
  218.  
  219.     OBJTYPENAME szLocalName;
  220.     TCHAR       szLocalDesc[ 512 ];
  221.  
  222.     OBJTYPENAME szRemoteName;
  223.     TCHAR       szRemoteDesc[ 512 ];
  224. } CONFINFO, *PCONFINFO;
  225.  
  226. // flags for uParam of IReplStore::ReportStatus 
  227. #define PSA_RESET_INTERRUPT ((UINT)0x00000001)  // this flag is set if we're clearing the interrupt state (ie. we go back to normal operation)
  228. #define PSA_SYS_SHUTDOWN    ((UINT)0x00000002)  // Windows is shutting down
  229.  
  230. // Actions for Setup 
  231. #define RSTP_SETUP          ((WORD)0x0001)  // New setup
  232. #define RSTP_CREATE         ((WORD)0x0002)  // New profile
  233. #define RSTP_RENAME         ((WORD)0x0003)  // Rename profile
  234. #define RSTP_DELETE         ((WORD)0x0004)  // Delete profile
  235.  
  236. //========================= IReplSetup ==============================
  237. //
  238.  
  239. DEFINE_GUID( IID_IReplSetup, /* 60178ec0-c670-11d0-837a-0000f80220b9 */
  240.     0x60178ec0,
  241.     0xc670,
  242.     0x11d0,
  243.     0x83, 0x7a, 0x00, 0x00, 0xf8, 0x02, 0x20, 0xb9
  244. );
  245.  
  246. #undef  INTERFACE
  247. #define INTERFACE   IReplSetup
  248. DECLARE_INTERFACE_( IReplSetup, IUnknown )
  249. {
  250.     // *** IReplSetup methods ***
  251.     STDMETHOD(          Setup )             ( THIS_ HWND hwndParent, DWORD dwDeviceId, WORD wAction ) PURE;
  252. };
  253.  
  254. //
  255. //========================= IReplStore ==============================
  256. //
  257. DEFINE_GUID (IID_IReplStore,            // a417bc0f-7be1-11ce-ad82-00aa006ec559
  258.     0xa417bc0f,
  259.     0x7be1,
  260.     0x11ce,
  261.     0xad, 0x82, 0x00, 0xaa, 0x00, 0x6e, 0xc5, 0x59
  262. );
  263.  
  264. // Flags for Initialize
  265. #define ISF_SELECTED_DEVICE     ((UINT)0x00000001)  // set if the store is initialized for selected device
  266.                                                     // otherwise it's initialized for connected device
  267. #define ISF_REMOTE_CONNECTED    ((UINT)0x00000002)  // set if the store is initialized during remote connection, all UI should be suppressed.
  268.  
  269. #undef  INTERFACE
  270. #define INTERFACE   IReplStore
  271. DECLARE_INTERFACE_( IReplStore, IUnknown )
  272. {
  273.     // *** IReplStore methods ***
  274.     STDMETHOD(          Initialize )        ( THIS_ IReplNotify *pNotify, UINT uFlags ) PURE;
  275.     STDMETHOD(          GetStoreInfo )      ( THIS_ PSTOREINFO pStoreInfo ) PURE;
  276.     STDMETHOD(          ReportStatus )      ( THIS_ HREPLFLD hFld, HREPLITEM hItem, UINT uStatus, UINT uParam ) PURE;
  277.     STDMETHOD_( int,    CompareStoreIDs)    ( THIS_ LPBYTE, UINT, LPBYTE, UINT ) PURE;
  278.  
  279.     // Item related routines
  280.     STDMETHOD_( int,    CompareItem )       ( THIS_ HREPLITEM hItem1, HREPLITEM hItem2 ) PURE;
  281.     STDMETHOD_( BOOL,   IsItemChanged)      ( THIS_ HREPLFLD hFld, HREPLITEM hItem, HREPLITEM hItemComp ) PURE;
  282.     STDMETHOD_( BOOL,   IsItemReplicated )  ( THIS_ HREPLFLD hFld, HREPLITEM hItem ) PURE;
  283.     STDMETHOD_( void,   UpdateItem )        ( THIS_ HREPLFLD hFld, HREPLITEM hItemDst, HREPLITEM hItemSrc ) PURE;
  284.  
  285.     // Folder related routines
  286.     STDMETHOD(          GetFolderInfo )     ( THIS_ LPSTR lpszObjType, HREPLFLD *phFld, IUnknown ** ) PURE;
  287.     STDMETHOD(          IsFolderChanged )   ( THIS_ HREPLFLD hFld, BOOL *pfChanged ) PURE;
  288.  
  289.     // Enumeration of folders
  290.     STDMETHOD(          FindFirstItem )     ( THIS_ HREPLFLD hFld,  HREPLITEM *phItem, BOOL *pfExist ) PURE;   // get first object the folder
  291.     STDMETHOD(          FindNextItem )      ( THIS_ HREPLFLD hFld,  HREPLITEM *phItem, BOOL *pfExist ) PURE;   // get next object the folder
  292.     STDMETHOD(          FindItemClose )     ( THIS_ HREPLFLD hFld ) PURE;                   // done enumerating
  293.  
  294.     // Object management routines
  295.     STDMETHOD_(UINT,    ObjectToBytes )     ( THIS_ HREPLOBJ hObject, LPBYTE lpb ) PURE;
  296.     STDMETHOD_(HREPLOBJ,BytesToObject )     ( THIS_ LPBYTE lpb, UINT cb ) PURE;
  297.     STDMETHOD_(void,    FreeObject )        ( THIS_ HREPLOBJ hObject ) PURE;
  298.     STDMETHOD_(BOOL,    CopyObject )        ( THIS_ HREPLOBJ hObjSrc, HREPLOBJ hObjDest ) PURE;
  299.     STDMETHOD(          IsValidObject )     ( THIS_ HREPLFLD hFld, HREPLITEM hObject, UINT uFlags ) PURE;
  300.  
  301.     // UI related routines
  302.     STDMETHOD(          ActivateDialog)     ( THIS_ UINT uidDialog, HWND hwndParent, HREPLFLD hFld, IEnumReplItem *penumItem ) PURE;
  303.     STDMETHOD(          GetObjTypeUIData)   ( THIS_ HREPLFLD hFld, POBJUIDATA pData ) PURE;
  304.     STDMETHOD(          GetConflictInfo )   ( THIS_ PCONFINFO pConfInfo ) PURE;
  305.     STDMETHOD(          RemoveDuplicates )  ( THIS_ LPSTR lpszObjType, UINT uFlags ) PURE;
  306. };
  307. #endif
  308.  
  309. //
  310. //=========== Section for object serializing & deserializing interfaces ==========
  311. //
  312. #define RSF_CONFLICT_OBJECT             0x00000001  // this is about getting/writting a conflicting object
  313. #define RSF_NEW_OBJECT                  0x00000002  // this is a new object to be written
  314. #define RSF_DUPLICATED_OBJECT           0x00000004  // the object is an exact duplicate of an existing object
  315. #define RSF_COMBINE                     0x00000008  // the object is being writen to desktop during a combine operation
  316. #define RSF_SYNC_DEVICE_ONLY            0x00000010  // the object should be sync'ed from device to desktop only
  317. #define RSF_SYNC_DESKTOP_ONLY           0x00000020  // the object should be sync'ed from desktop to device only
  318. #define RSF_UPDATED_HANDLE              0x00000040  // this is a new object, but the oid already exists (eg, file rename)
  319. #define RSF_DISCARDED_OBJ               0x00000080  // used in DeleteObj. indicates the object is deleted as a result of RERR_DISCARD being returned by SetPacket
  320. #define RSF_NEW_VOLUME                  0x00000100  // used by ActiveSync manager only.
  321.  
  322. #define RSF_RESERVED1                   0x00100000  // reserved by ActiveSync manager
  323. #define RSF_RESERVED2                   0x00200000
  324. #define RSF_RESERVED3                   0x00400000
  325. #define RSF_RESERVED4                   0x00800000
  326.  
  327. typedef struct _tagReplSetup
  328. {
  329.     UINT        cbStruct;
  330.     BOOL        fRead;
  331.     DWORD       dwFlags;                // see RSF_xxx above.
  332.     HRESULT     hr;     
  333.     OBJTYPENAME szObjType;
  334.     IReplNotify *pNotify;
  335.  
  336.     DWORD       oid;        
  337.     DWORD       oidNew;     
  338.  
  339. #ifndef UNDER_CE
  340.     IReplStore  *pStore;
  341.  
  342.     HREPLFLD    hFolder;
  343.     HREPLITEM   hItem;
  344. #endif
  345.  
  346.     LPBYTE  lpbVolumeID;    // ID of the volume for the object. NULL if the object is in the default volume
  347.     UINT    cbVolumeID;     // size of above ID in bytes
  348. } REPLSETUP, *PREPLSETUP;
  349.  
  350.  
  351. //========================= IReplObjHandler ==============================
  352. //
  353. // Specifies the interface for replication object handler 
  354. // (object serializer/deserializer)
  355. #undef  INTERFACE
  356. #define INTERFACE   IReplObjHandler
  357. DECLARE_INTERFACE_( IReplObjHandler, IUnknown )
  358. {
  359.     //  Called everytime when an object is about to be serialized/deserialized
  360.     STDMETHOD( Setup )  ( THIS_ PREPLSETUP pSetup ) PURE;
  361.  
  362.     //  Called everytime when it's the time to clean up the serializer/deserializer for the object
  363.     STDMETHOD( Reset ) ( THIS_ PREPLSETUP pSetup ) PURE;
  364.  
  365.     /* A request to get a data packet (serialize the object)
  366.     handler should pass back the buffer along with the size bytes */
  367.     STDMETHOD( GetPacket )(  THIS_ LPBYTE *lppbData,  DWORD *pcbData, DWORD cbRecommend ) PURE;
  368.  
  369.     /* A request to set a data packet (deserialize the byte stream) */
  370.     STDMETHOD( SetPacket )( THIS_ LPBYTE lpbData, DWORD cbData ) PURE;
  371.  
  372.     /* A request to delete the given object */
  373.     STDMETHOD( DeleteObj )( THIS_ PREPLSETUP pSetup ) PURE;
  374. };
  375.  
  376. typedef struct tagObjTypeInfo
  377. {
  378.     UINT            cbStruct;       // Input. Size of the structure in bytes.
  379.     OBJTYPENAMEW    szObjType;      // Input, the object type name
  380.     UINT            uFlags;         // Reserved. Not in use yet.
  381.     WCHAR           szName[ 80 ];   // Output, the name of a file system object storing all these object
  382.     UINT            cObjects;       // Output, number of existing objects
  383.     UINT            cbAllObj;       // Output, total number of bytes used to store existing objects
  384.     FILETIME        ftLastModified; // Output, last time any object is modified
  385. } OBJTYPEINFO, *POBJTYPEINFO;
  386.  
  387. #ifdef UNDER_CE
  388.  
  389. #define ONF_FILE            ((UINT)0x00000001)
  390. #define ONF_DIRECTORY       ((UINT)0x00000002)
  391. #define ONF_DATABASE        ((UINT)0x00000004)
  392. #define ONF_RECORD          ((UINT)0x00000008)
  393.  
  394. #define ONF_CHANGED         ((UINT)0x00000010)  // set if the file system object is changed
  395. #define ONF_DELETED         ((UINT)0x00000020)  // set if the file system object is deleted
  396.  
  397. #define ONF_CLEAR_CHANGE    ((UINT)0x00000040)  // client should clear the change bit for the object whose object id is pointed at by poid
  398. #define ONF_CALL_BACK       ((UINT)0x00000080)  // Output, client asks server to call ObjectNotify 2 sec. later.
  399. #define ONF_CALLING_BACK    ((UINT)0x00000100)  // set if this call is a result of ONF_CALL_BACK being set earlier
  400.  
  401. /*  Definitions of cOidChg, cOidDel and poid
  402.     in all cases, poid points to a list of object id's
  403.  
  404. 1) when ONF_CHANGED is set, cOidChg is the number of object id's in the list that should be synchronized. cOidDel is not used
  405. 2) when ONF_DELETED is set, cOidChg is not used, cOidDel is the number of deleted object id's in the list that should be synchronized
  406. 3) when both ONF_CHANGED & ONF_DELETED is not set,
  407.     cOidChg is count of object id's in the first part of the list for objects that are changed
  408.     cOidDel is count of object id's in the later part of the list for objects that are not changed
  409.     
  410. */
  411.  
  412. typedef struct tagObjNotify
  413. {
  414.     UINT        cbStruct;       // Input. Size of the structure in bytes.
  415.     OBJTYPENAME szObjType;      // Input, the object type name
  416.     UINT        uFlags;         // Input, Flags, see ONF_xxx above
  417.     UINT        uPartnerBit;    // Input, which partner this 
  418.     CEOID       oidObject;      // Input. CEOID of the file system object changed/deleted
  419.     CEOIDINFO   oidInfo;        // Input. Information about the file system object
  420.  
  421.     UINT        cOidChg;        // Output, see above comment for definition.
  422.     UINT        cOidDel;        // Output, see above comment for definition.
  423.     UINT        *poid;          // Output, see above comment for definition.
  424.                                 // Note that, memory pointed to by this pointer is owned by the clients. 
  425.                                 // It will not be freed by replication.
  426.     LPBYTE      lpbVolumeID;    // ID of the volume where all above objects lives. NULL if the objects are in RAM
  427.     UINT        cbVolumeID;     // size of above ID in bytes
  428. } OBJNOTIFY, *POBJNOTIFY;
  429.  
  430. #define FO_MORE_VOLUME      ((UINT)0x00000001)  // set by ActiveSync module. there are more volumes of objects
  431. #define FO_DONE_ONE_VOL     ((UINT)0x00000002)  // set by ActiveSync manager, let ActiveSync module to free up the memory allocated in FINDOBJINFO
  432.  
  433. typedef struct tagFindObjInfo
  434. {
  435.     UINT        uFlags;         // See FO_* above
  436.     OBJTYPENAME szObjType;      // what object type we need to enumerate
  437.  
  438.     UINT        *poid;          // points to list of object ID's, 
  439.                                 // first part is for unchanged objects, last part is for changed objects
  440.  
  441.     UINT        cUnChg;         // # of unchanged object ID's in above list
  442.     UINT        cChg;           // # of changed object ID's in above list
  443.  
  444.     LPBYTE      lpbVolumeID;    // ID of the volume where all above objects lives. NULL if the objects are in RAM
  445.     UINT        cbVolumeID;     // size of above ID in bytes
  446.  
  447.     LPVOID      lpvUser;        // an ActiveSync module can save anything it wants in this variable
  448. } FINDOBJINFO, *PFINDOBJINFO;
  449.  
  450. #ifdef __cplusplus
  451. extern "C"{
  452. #endif 
  453.  
  454. // Functions exported by client's device module
  455.  
  456. // for Function: InitObjType
  457. typedef BOOL (*PINITOBJPROC)( LPWSTR lpszObjType, IReplObjHandler **ppObjHandler, UINT uPartnerBit );
  458.  
  459. // for Function: ObjectNofity
  460. typedef BOOL (*POBJNOTIFYPROC)( POBJNOTIFY );
  461.  
  462. // for Function: GetObjTypeInfo
  463. typedef BOOL (*PGETOBJTYPEINFO)( POBJTYPEINFO );
  464.  
  465. // for Function: ReportStatus
  466. typedef BOOL (*PREPORTSTATUS)( LPWSTR lpszObjType, UINT uCode, UINT uParam );
  467.  
  468. // for Function: FindObjects
  469. typedef HRESULT (*PFINDOBJECTS)( PFINDOBJINFO );
  470.  
  471. // for Function: SyncData
  472. typedef HRESULT (*PSYNCDATA )( PSDREQUEST psd );
  473.  
  474. #ifdef __cplusplus
  475. }
  476. #endif
  477.  
  478. #endif  // UNDER_CE
  479.  
  480. #define SZ_OUTSTORE_PROG_ID     TEXT( "MS.WinCE.OutLook" )
  481. #define SZ_SCDSTORE_PROG_ID     TEXT( "MS.WinCE.SchedulePlus" )
  482.  
  483. #define SZ_APPT                 TEXT( "Appointment" )
  484. #define SZ_CONTACT              TEXT( "Contact" )
  485. #define SZ_TASK                 TEXT( "Task" )
  486. #define SZ_FILE                 TEXT( "File" )
  487. #define SZ_INBOX                TEXT( "Inbox" )
  488.  
  489. #endif  // _INC_CESYNC_H
  490.